#! /usr/bin/python
# ! -*- coding:UTF-8 -*-

from iButton import *
import dataProcess as dp
import Tkinter as tk

root = tk.Tk()

#################################

# 初始化主面板
main_frame = tk.Frame(root, width=500, height=500, background="white")
main_frame.pack(padx=5, pady=5)  # , expand=True, fill=tk.BOTH

# 添加button，100*100

for i in range(dp.NUMBER_OF_ITEM):
    for j in range(dp.NUMBER_OF_ITEM):
        bt = tk.Button(main_frame, background="white", width=3, height=1)
        dp.btns[i][j] = iButton(bt, False, i, j)  # 将该按钮对象保存到数组中
        tmp = dp.btns[i][j]
        bt["command"] = (lambda x=bt, check_button=tmp: dp.onclick(x, check_button))
        bt.grid(row=i, column=j)

# 添加下一步按钮
btn_refresh = tk.Button(root, text="Next", command=dp.next_step)
btn_refresh.pack()

root.mainloop()
